{% block sw_settings_country_general %}
<div>
    {% block sw_settings_country_general_card %}
    <mt-card
        position-identifier="sw-settings-country-detail-general"
        :title="$tc('sw-settings-country.detail.titleCard')"
        :is-loading="isLoading"
    >
        <sw-container
            columns="repeat(auto-fit, minmax(250px, 1fr))"
            gap="0px 30px"
        >

            <!-- eslint-disable sw-deprecation-rules/no-twigjs-blocks, vue/attributes-order -->
            {% block sw_settings_country_general_content_field_name %}

            <mt-text-field
                v-model="country.name"
                name="sw-field--country-name"
                required
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelName')"
                :placeholder="placeholder(country, 'name', $tc('sw-settings-country.detail.placeholderName'))"
                :error="countryNameError"
            />
            {% endblock %}

            {% block sw_settings_country_general_content_field_position %}
            <mt-number-field
                v-model="country.position"
                name="sw-field--country-position"
                number-type="int"
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelPosition')"
                :placeholder="placeholder(country, 'position', $tc('sw-settings-country.detail.placeholderPosition'))"
            />
            {% endblock %}

            {% block sw_settings_country_general_content_field_iso %}

            <mt-text-field
                v-model="country.iso"
                name="sw-field--country-iso"
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelIso')"
                :placeholder="placeholder(country, 'iso', $tc('sw-settings-country.detail.placeholderIso'))"
            />
            {% endblock %}

            {% block sw_settings_country_general_content_field_iso3 %}

            <mt-text-field
                v-model="country.iso3"
                name="sw-field--country-iso3"
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelIso3')"
                :placeholder="placeholder(country, 'iso3', $tc('sw-settings-country.detail.placeholderIso3'))"
            />
            {% endblock %}
        </sw-container>
    </mt-card>
    {% endblock %}

    {% block sw_settings_country_general_options_card %}
    <mt-card
        position-identifier="sw-settings-country-general"
        :title="$tc('sw-settings-country.detail.titleOptions')"
        :is-loading="isLoading"
    >
        <sw-container class="sw-settings-country-general__options-container">

            {% block sw_settings_country_general_content_field_active %}

            <mt-switch
                v-model="country.active"
                name="sw-field--country-active"
                class="sw-settings-country-general__option-items"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelActive')"
            />
            {% endblock %}

            {% block sw_settings_country_general_content_field_shipping_available %}

            <mt-switch
                v-model="country.shippingAvailable"
                name="sw-field--country-shippingAvailable"
                class="sw-settings-country-general__option-items"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelShippingAvailable')"
            />
            {% endblock %}

            {% block sw_settings_country_general_content_field_tax_free %}

            <mt-switch
                v-model="country.customerTax.enabled"
                name="sw-field--country-customerTax-enabled"
                class="sw-settings-country-general__option-items switch-field-customer-tax-free"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelTaxFree')"
            />
            {% endblock %}

            <sw-container
                v-if="country.customerTax.enabled"
                class="sw-settings-country-general-customer-tax"
            >

                {% block sw_settings_country_general_content_field_tax_free_from_customer %}
                {% block sw_settings_country_general_content_field_tax_free_from_customer_value %}
                <mt-number-field
                    v-model="country.customerTax.amount"
                    name="sw-field--country-customerTax-amount"
                    class="sw-settings-country-general__input-amount customer-tax-amount"
                    :min="0"
                    :label="$tc('sw-settings-country.detail.taxFreeFrom')"
                    :help-text="$tc('sw-settings-country.detail.taxFreeFromHelpText')"
                    :disabled="!acl.can('country.editor') || undefined"
                >
                    <template #suffix>
                        <sw-entity-single-select
                            v-model:value="country.customerTax.currencyId"
                            name="sw-field--country-customerTax-currencyId"
                            class="sw-settings-country-general__customer-select-currency sw-settings-country-general__select"
                            entity="currency"
                            bordered
                            show-clearable-button
                            :disabled="!acl.can('country.editor') || undefined"
                        />
                    </template>
                </mt-number-field>
                {% endblock %}
                {% endblock %}

                {% block sw_settings_country_general_content_show_tax_free_currency_dependent_values %}
                <sw-container
                    columns="1fr"
                    justify="end"
                >
                    <a
                        class="sw-settings-country-general__currency-dependent-modal"
                        role="button"
                        tabindex="0"
                        @click="openCustomerTaxModal"
                        @keydown.enter="openCustomerTaxModal"
                    >
                        {{ $tc('sw-settings-country.detail.currencyDependentValues') }}
                        <mt-icon
                            name="regular-long-arrow-right"
                            size="16px"
                        />
                    </a>
                </sw-container>
                {% endblock %}

            </sw-container>

            {% block sw_settings_country_general_content_field_tax_free_companies %}

            <mt-switch
                v-model="country.companyTax.enabled"
                name="sw-field--country-companyTax-enabled"
                class="sw-settings-country-general__option-items switch-field-company-tax-free"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelCompanyTaxFree')"
                :help-text="$tc('sw-settings-country.detail.helpTextCompanyTaxFree')"
            />
            {% endblock %}

            <sw-container
                v-if="country.companyTax.enabled"
                class="sw-settings-country-general-company-tax"
            >

                {% block sw_settings_country_general_content_field_tax_free_from_companies %}
                {% block sw_settings_country_general_content_field_tax_free_from_companies_value %}
                <mt-number-field
                    v-model="country.companyTax.amount"
                    name="sw-field--country-companyTax-amount"
                    class="sw-settings-country-general__input-amount"
                    :min="0"
                    :label="$tc('sw-settings-country.detail.taxFreeFrom')"
                    :help-text="$tc('sw-settings-country.detail.taxFreeFromHelpText')"
                    :disabled="!acl.can('country.editor') || undefined"
                >
                    <template #suffix>
                        <sw-entity-single-select
                            v-model:value="country.companyTax.currencyId"
                            name="sw-field--country-companyTax-currencyId"
                            class="sw-settings-country-general__company-select-currency sw-settings-country-general__select"
                            entity="currency"
                            show-clearable-button
                            :disabled="!acl.can('country.editor') || undefined"
                        />
                    </template>
                </mt-number-field>
                {% endblock %}
                {% endblock %}

                {% block sw_settings_country_general_content_show_company_tax_free_currency_dependent_values %}
                <sw-container
                    columns="1fr"
                    justify="end"
                >
                    <a
                        class="sw-settings-country-general__currency-dependent-modal"
                        role="button"
                        tabindex="0"
                        @click="openCompanyTaxModal"
                        @keydown.enter="openCompanyTaxModal"
                    >
                        {{ $tc('sw-settings-country.detail.currencyDependentValues') }}
                        <mt-icon
                            name="regular-long-arrow-right"
                            size="16px"
                        />
                    </a>
                </sw-container>
                {% endblock %}
            </sw-container>

            {% block sw_settings_country_general_content_show_currency_dependent_modal %}
            <sw-settings-country-currency-dependent-modal
                v-if="showCurrencyModal"
                :currency-depends-value="currencyDependsValue"
                :country-id="countryId"
                :is-loading="isLoading"
                :menu-options="menuOptions"
                :user-config="userConfig"
                :user-config-values="userConfigValues"
                :tax-free-type="taxFreeType"
                @modal-close="onToggleCurrencyModal"
                @modal-save="saveCountryCurrencyDependent"
                @base-item-change="changeBaseItem"
            />
            {% endblock %}

            {% block sw_settings_country_general_content_field_check_vat_id_format %}

            <mt-switch
                v-model="country.checkVatIdPattern"
                name="sw-field--country-checkVatIdPattern"
                class="sw-settings-country-general__field-check-vatid-format sw-settings-country-general__option-items"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelCheckVatIdFormat')"
                :help-text="$tc('sw-settings-country.detail.helpTextCheckVatIdFormat')"
            />
            {% endblock %}

            {% block sw_settings_country_general_content_field_vat_id_required %}

            <mt-switch
                v-model="country.vatIdRequired"
                name="sw-field--country-vatIdRequired"
                class="sw-settings-country-general__vat-id-required sw-settings-country-general__option-items"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelVatIdRequired')"
                :help-text="$tc('sw-settings-country.detail.helpTextLabelVatIdRequired')"
            />
            {% endblock %}

            {% block sw_settings_country_general_content_field_is_eu %}

            <mt-switch
                v-model="country.isEu"
                name="sw-field--country-isEu"
                class="sw-settings-country-general__is-eu sw-settings-country-general__option-items"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelIsEu')"
                :help-text="$tc('sw-settings-country.detail.helpTextIsEu')"
            />
            {% endblock %}
        </sw-container>
    </mt-card>
    {% endblock %}

</div>
{% endblock %}
